package com.qfedu.fmmall.controller;

import com.qfedu.fmmall.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author liuyadi
 */
@RestController
@RequestMapping("/good")
@Api(value = "提供商品添加、修改、删除及查询的相关接口", tags = "商品管理")
public class GoodsController {

    @PostMapping(value = "/add")
    public ResultVO addGoods() {
        return null;
    }

    @ApiOperation(value = "通过商品id删除接口")
    @ApiImplicitParam(type = "int", name = "id", value = "商品id")
    @DeleteMapping(value = "/{id}")
    public ResultVO deleteGoods(@PathVariable(name = "id") int goodsId) {
        System.out.println("需要删除的商品是：" + goodsId);
        return null;
    }

    @PutMapping(value = "/update")
    public void updateGoods() {
        System.out.println("产品更新方法");
    }

    @GetMapping(value = "/list")
    public void listGoods() {
        System.out.println("产品查询方法");
    }

    @ApiOperation(value = "通过商品id查询商品接口")
    @ApiImplicitParam(dataType = "int", name = "id", value = "商品id", required = true)
    @GetMapping("/{id}}")
    public ResultVO getGoodById(@PathVariable(value = "id", required = true) int goodId) {
        System.out.println("查询的商品id为：" + goodId);
        return null;
    }
}
